<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!--返回错误信息-->
<?php echo validation_errors(); ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <?php
    $title = [
        'title' => '招投标管理',
    ];
    $this->load->view('/admin/common/header', $title);
    ?>
</head>

<body data-type="widgets">
	<script src="/assets/js/theme.js"></script>
	<div class="am-g tpl-g">

	    <!--    头部   侧边菜单-->
	    <?php $this->load->view('/admin/common/bodyLeft'); ?>
    <script type="text/javascript">
    	$(".js-sidebar-nav>li:nth-child(12)>ul").show(80);
    	$(".js-sidebar-nav>li:nth-child(12)>a>span").addClass("sidebar-nav-sub-ico-rotate");
    	$(".js-sidebar-nav>li:nth-child(12)>ul>li:nth-child(2)>a").addClass("active");
    </script>
	    <!-- 内容区域 -->
	    
	</div>
	<div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title  am-cf">
                                <ol class="am-breadcrumb am-breadcrumb-slash">
                                    <li><a href="/admin/bidding/index?page=1">招投标管理</a></li>
                                    <li class="am-active"><a href="/admin/bidding/waitingList?page=1">供应商待办</a></li>
                                    <li class="am-active">支付保证金</li>
                                </ol>
                            </div>
                        </div>
                        <div class="am-cf">
                        <br />
		                    <form action="https://cashier.allinpay.com/gateway/index.do" class="am-form am-form-horizontal" method="post" id="myForm">
		                    	<div class="am-form-group am-u-sm-4 am-u-sm-centered">
								    <label for="" class="am-u-sm-3 am-form-label">保证金金额：</label>
								    <div class="am-u-sm-9 am-input-group" >
								     	<input type="text" class="am-form-field" id="needAmount" value="<?php echo $needAmount ?>" readonly>
								     	<span class="am-input-group-label" >元</span>

                                        <input type="hidden" name="supplierId" value="149">
								    </div>
								</div>


                                <input type="hidden" name="inputCharset" id="inputCharset" value="1" />
                                <input type="hidden" name="pickupUrl" id="pickupUrl" value="<?php echo $pickupUrl?>"/>
                                <input type="hidden" name="receiveUrl" id="receiveUrl" value="<?php echo $receiveUrl?>" />
                                <input type="hidden" name="version" id="version" value="<?php echo $version?>"/>
                                <input type="hidden" name="signType" id="signType" value="<?php echo $signType?>"/>
                                <input type="hidden" name="merchantId" id="merchantId" value="<?php echo $merchantId?>" />

                                <input type="hidden" name="orderNo" id="orderNo" value="<?php echo $orderNo?>" />
                                <input type="hidden" name="orderAmount" id="orderAmount" value="<?php echo $orderAmount ?>"/>
                                <input type="hidden" name="orderCurrency" id="orderCurrency" value="<?php echo $orderCurrency?>" />
                                <input type="hidden" name="orderDatetime" id="orderDatetime" value="<?php echo $orderDatetime?>" />

                                <input type="hidden" name="ext1" id="ext1" value="<?php echo $ext1?>" />
                                <input type="hidden" name="payType" value="<?php echo $payType?>" />
                                <input type="hidden" name="signMsg" id="signMsg" value="<?php echo $signMsg?>" />


                                <div class="am-u-sm-12 btn-box">
                                    <input type="button" value="去支付" name="action" class="am-btn am-btn-primary tpl-btn-bg-color-success am-u-sm-centered commit" style="width:220px;margin: 20px;" data-am-modal="{target: '#my-modal-loading'}">
                                </div>

		                    </form>
	                    </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<!--    <div class="am-modal am-modal-loading am-modal-no-btn" tabindex="-1" id="my-modal-loading">-->
<!--		<div class="am-modal-dialog">-->
<!--		    <div class="am-modal-hd"><h2>支付提示</h2></div>-->
<!--		    <div class="am-modal-bd">-->
<!--		      	<span><img src="../../../assets/img/working.gif"></span>-->
<!--		      	<div class="modal-content">-->
<!--		      		<p>支付完成前，请不要关闭此支付验证窗口。</p>-->
<!--		      		<p>支付完成后，请根据您支付的情况点击下面按钮。</p>-->
<!--		      	</div>-->
<!--		      	<div class="btn-box">-->
<!--		      		<a href="/admin/bidding/payResult"><button type="button" class="am-btn am-btn-danger">支付遇到问题</button></a>-->
<!--		      		<a href="/admin/bidding/payResult"><button type="button" class="am-btn am-btn-primary">支付完成</button></a>-->
<!--		      	</div>-->
<!---->
<!--		    </div>-->
<!--		</div>-->
<!--	</div>-->

	<script>
	    function back() {
	        window.history.back();
	    }

        function GetQueryString(name)
        {
            var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if(r!=null)return  unescape(r[2]); return null;
        }

        $(".commit").on("click",function(){
            var id = GetQueryString("id");
            var orderNo = $("#orderNo").val();
            var orderDatetime = $("#orderDatetime").val();
            var needAmount = $("#needAmount").val(); //保证金

            $.ajax({
                url:"/admin/bidding/editWaitOrderNo",
                data:{
                    orderNo: orderNo ,
                    id: id,
                    orderDatetime: orderDatetime,
                    needAmount: needAmount  //保证金
                },
                type:"post",
                success:function(){
                    $("#myForm").submit();
                }
            });
        });
	</script>

	<script src="/assets/js/amazeui.min.js"></script>
	<script src="/assets/js/amazeui.datatables.min.js"></script>
	<script src="/assets/js/dataTables.responsive.min.js"></script>
	<script src="/assets/js/app.js"></script>

</body>

</html>